package question3;

import java.util.HashMap;

public class HashMapDemo {
    static double sum=0;
    public static void main(String[] args) {

        HashMap<Commodity, Integer> hm = new HashMap<>();
        hm.put(new Commodity("华为手机P80",8888.0),3);
        hm.put(new Commodity("小米手环",1666.0),10);
        hm.put(new Commodity("小米智能音箱",199.0),20);
        hm.put(new Commodity("电动牙刷",50.0),40);
        hm.forEach((c,i)-> sum+=c.getPrice()*i);
        System.out.println(sum);
    }
}
